using SqlSugar;

namespace ChatBackend.Models
{
    [SugarTable("ChatRooms")]
    public class ChatRoom
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(Length = 100, IsNullable = false)]
        public string Name { get; set; } = string.Empty;

        [SugarColumn(Length = 500, IsNullable = true)]
        public string? Description { get; set; }

        [SugarColumn(IsNullable = false)]
        public ChatRoomType Type { get; set; } = ChatRoomType.Group;

        [SugarColumn(IsNullable = false)]
        public int CreatedBy { get; set; }

        [SugarColumn(IsNullable = false, ColumnDataType = "TEXT")]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        [SugarColumn(IsNullable = false, ColumnDataType = "TEXT")]
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

        [SugarColumn(IsNullable = false)]
        public bool IsActive { get; set; } = true;
    }

    public enum ChatRoomType
    {
        Direct = 1,  // 单聊
        Group = 2    // 群聊
    }
}
